package com.ss.android.newmedia.webview;

import android.content.ActivityNotFoundException;
import android.content.Intent;

import com.ss.android.common.app.permission.PermissionsResultAction;

final class c extends PermissionsResultAction {
    private final BaseWebChromeClient c;
    private final String a;
    private final String b;

    c(BaseWebChromeClient arg1, String arg2, String arg3) {
        this.c = arg1;
        this.a = arg2;
        this.b = arg3;

    }

    public final void onGranted() {
        Intent v0_1;
        try {
            if (this.a.equals("image/*")) {
                if (this.b.equals("camera")) {
                    this.c.a(this.c.b());
                    return;
                }

                v0_1 = BaseWebChromeClient.createChooserIntent(new Intent[]{this.c.b()});
                v0_1.putExtra("android.intent.extra.INTENT", BaseWebChromeClient.createGetContentIntent("image/*"));
                this.c.a(v0_1);
                return;
            }

            if (this.a.equals("video/*")) {
                if (this.b.equals("camcorder")) {
                    this.c.a(BaseWebChromeClient.createVideoCaptureIntent());
                    return;
                }

                v0_1 = BaseWebChromeClient.createChooserIntent(new Intent[]{BaseWebChromeClient.createVideoCaptureIntent()});
                v0_1.putExtra("android.intent.extra.INTENT", BaseWebChromeClient.createGetContentIntent("video/*"));
                this.c.a(v0_1);
                return;
            }

            if (!this.a.equals("audio/*")) {
                return;
            }

            if (this.b.equals("microphone")) {
                this.c.a(BaseWebChromeClient.createRecordSoundIntent());
                return;
            }

            v0_1 = BaseWebChromeClient.createChooserIntent(new Intent[]{BaseWebChromeClient.createRecordSoundIntent()});
            v0_1.putExtra("android.intent.extra.INTENT", BaseWebChromeClient.createGetContentIntent("audio/*"));
            this.c.a(v0_1);
        } catch (ActivityNotFoundException v0) {
            try {
                this.c.b = true;
                this.c.a(this.c.a());
            } catch (ActivityNotFoundException v1) {
                v0.printStackTrace();
            }
        }
    }

    public final void onDenied(String arg3) {
        if (this.c.mFilePathCallback != null) {
            this.c.mFilePathCallback.onReceiveValue(null);
        }
    }
}

